

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>l5kit.geometry package &mdash; L5Kit 1.0.0 documentation</title>
  

  
  <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

  
  
  
  

  
  <!--[if lt IE 9]>
    <script src="../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
        <script src="../_static/jquery.js"></script>
        <script src="../_static/underscore.js"></script>
        <script src="../_static/doctools.js"></script>
        <script src="../_static/language_data.js"></script>
    
    <script type="text/javascript" src="../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="l5kit.geometry.angle module" href="l5kit.geometry.angle.html" />
    <link rel="prev" title="l5kit.evaluation.write_csv module" href="l5kit.evaluation.write_csv.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="../index.html" class="icon icon-home" alt="Documentation Home"> L5Kit
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../README.html">ML Prediction, Planning and Simulation for Self-Driving</a></li>
<li class="toctree-l1"><a class="reference internal" href="../README.html#examples">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../README.html#news">News</a></li>
<li class="toctree-l1"><a class="reference internal" href="../README.html#overview">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="../README.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../README.html#license">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="../README.html#credits">Credits</a></li>
<li class="toctree-l1"><a class="reference internal" href="../README.html#contact">Contact</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../api_reference.html">API Reference</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="l5kit.data.html">l5kit.data package</a></li>
<li class="toctree-l2"><a class="reference internal" href="l5kit.dataset.html">l5kit.dataset package</a></li>
<li class="toctree-l2"><a class="reference internal" href="l5kit.evaluation.html">l5kit.evaluation package</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">l5kit.geometry package</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#submodules">Submodules</a><ul>
<li class="toctree-l4"><a class="reference internal" href="l5kit.geometry.angle.html">l5kit.geometry.angle module</a></li>
<li class="toctree-l4"><a class="reference internal" href="l5kit.geometry.image.html">l5kit.geometry.image module</a></li>
<li class="toctree-l4"><a class="reference internal" href="l5kit.geometry.transform.html">l5kit.geometry.transform module</a></li>
<li class="toctree-l4"><a class="reference internal" href="l5kit.geometry.voxel.html">l5kit.geometry.voxel module</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="l5kit.kinematic.html">l5kit.kinematic package</a></li>
<li class="toctree-l2"><a class="reference internal" href="l5kit.random.html">l5kit.random package</a></li>
<li class="toctree-l2"><a class="reference internal" href="l5kit.sampling.html">l5kit.sampling package</a></li>
<li class="toctree-l2"><a class="reference internal" href="l5kit.visualization.html">l5kit.visualization package</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../data_format.html">Dataset Formats</a></li>
<li class="toctree-l1"><a class="reference internal" href="../how_to_contribute.html">How to contribute</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../index.html">L5Kit</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../api_reference.html">API Reference</a> &raquo;</li>
        
      <li>l5kit.geometry package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="../_sources/API/l5kit.geometry.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="module-l5kit.geometry">
<span id="l5kit-geometry-package"></span><h1>l5kit.geometry package<a class="headerlink" href="#module-l5kit.geometry" title="Permalink to this headline">¶</a></h1>
<dl class="py function">
<dt id="l5kit.geometry.angle_between_vectors">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">angle_between_vectors</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">v1</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">v2</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em><span class="sig-paren">)</span> &#x2192; float<a class="headerlink" href="#l5kit.geometry.angle_between_vectors" title="Permalink to this definition">¶</a></dt>
<dd><p>angle_between_vectors returns the angle in radians between two vectors.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>v1</strong> (<em>np.ndarray</em>) – Vector 1 of shape (N)</p></li>
<li><p><strong>v2</strong> (<em>np.ndarray</em>) – Vector 2 of same shape as <code class="docutils literal notranslate"><span class="pre">v1</span></code></p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>angle in radians</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>float</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.compute_yaw_around_north_from_direction">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">compute_yaw_around_north_from_direction</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">direction_vector</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em><span class="sig-paren">)</span> &#x2192; float<a class="headerlink" href="#l5kit.geometry.compute_yaw_around_north_from_direction" title="Permalink to this definition">¶</a></dt>
<dd><p>compute_yaw_from_direction computes the yaw as angle between a 2D input direction vector and
the y-axis direction vector (0, 1).</p>
<blockquote>
<div><dl class="simple">
<dt>Args:</dt><dd><p>direction_vector (np.ndarray): Vector of shape (2,)</p>
</dd>
<dt>Returns:</dt><dd><p>float: angle to (0,1) vector in radians</p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.crop_rectangle_from_image">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">crop_rectangle_from_image</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">image</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">corners</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="headerlink" href="#l5kit.geometry.crop_rectangle_from_image" title="Permalink to this definition">¶</a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">crop_rectangle_from_image</span></code> takes an image and 4 corners in pixel coordinates, it returns
the sub-image inside that cropped area, rotated upright.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>image</strong> (<em>np.ndarray</em>) – image to crop from</p></li>
<li><p><strong>corners</strong> (<em>np.ndarray</em>) – corners, array of shape (4,2)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>crop from input containing the corners</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.ecef_to_geodetic">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">ecef_to_geodetic</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">point</span><span class="p">:</span> <span class="n">Union<span class="p">[</span>numpy.ndarray<span class="p">, </span>Sequence<span class="p">[</span>float<span class="p">]</span><span class="p">]</span></span></em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="headerlink" href="#l5kit.geometry.ecef_to_geodetic" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert given ECEF coordinate into latitude, longitude, altitude.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>point</strong> (<em>Union</em><em>[</em><em>np.ndarray</em><em>, </em><em>Sequence</em><em>[</em><em>float</em><em>]</em><em>]</em>) – ECEF coordinate vector</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>latitude, altitude, longitude</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.flip_y_axis">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">flip_y_axis</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">tm</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">y_dim_size</span><span class="p">:</span> <span class="n">int</span></em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="headerlink" href="#l5kit.geometry.flip_y_axis" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a new matrix that also performs a flip on the y axis.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tm</strong> – the original 3x3 matrix</p></li>
<li><p><strong>y_dim_size</strong> – this should match the resolution on y. It makes all coordinates positive</p></li>
</ul>
</dd>
</dl>
<p>Returns: a new 3x3 matrix.</p>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.geodetic_to_ecef">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">geodetic_to_ecef</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">lla_point</span><span class="p">:</span> <span class="n">Union<span class="p">[</span>numpy.ndarray<span class="p">, </span>Sequence<span class="p">[</span>float<span class="p">]</span><span class="p">]</span></span></em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="headerlink" href="#l5kit.geometry.geodetic_to_ecef" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert given latitude, longitude, and optionally altitude into ECEF
coordinates. If no altitude is given, altitude 0 is assumed.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>lla_point</strong> (<em>Union</em><em>[</em><em>np.ndarray</em><em>, </em><em>Sequence</em><em>[</em><em>float</em><em>]</em><em>]</em>) – Latitude, Longitude and optionally Altitude</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>3D ECEF coordinate</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.get_transformation_matrix">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">get_transformation_matrix</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">translation</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">rotation</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="headerlink" href="#l5kit.geometry.get_transformation_matrix" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a 3D transformation matrix from translation vector and quaternion rotation</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>translation</strong> (<em>np.ndarray</em>) – 3D translation vector</p></li>
<li><p><strong>rotation</strong> (<em>np.ndarray</em>) – 4 quaternion values</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>4x4 transformation matrix</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.normalize_intensity">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">normalize_intensity</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">x</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">max_intensity</span><span class="p">:</span> <span class="n">float</span></em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="headerlink" href="#l5kit.geometry.normalize_intensity" title="Permalink to this definition">¶</a></dt>
<dd><p>Normalize (divide by max) and clip intensity values to fall between 0 and 1.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>x</strong> (<em>np.npdarray</em>) – numpy array of any shape</p></li>
<li><p><strong>max_intensity</strong> (<em>float</em>) – Maximum intensity value (anything above this will become 1)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>np.ndarray – array of same type and shape as x with values between 0 and 1 only</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.points_within_bounds">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">points_within_bounds</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">coords</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">shape</span><span class="p">:</span> <span class="n">Union<span class="p">[</span>Collection<span class="p">[</span>int<span class="p">]</span><span class="p">, </span>numpy.ndarray<span class="p">]</span></span></em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="headerlink" href="#l5kit.geometry.points_within_bounds" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>coords</strong> (<em>np.ndarray</em>) – (N,3)-shaped array containing points.</p></li>
<li><p><strong>shape</strong> (<em>tuple of ints</em><em> or </em><em>np.ndarray</em>) – shape to use as bounds, should be length 3</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Binary mask for given coords array which is True for points that fall within the bounds of shape.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.rotation33_as_yaw">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">rotation33_as_yaw</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">rotation</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em><span class="sig-paren">)</span> &#x2192; float<a class="headerlink" href="#l5kit.geometry.rotation33_as_yaw" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the yaw component of given 3x3 rotation matrix.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>rotation</strong> (<em>np.ndarray</em>) – 3x3 rotation matrix (np.float64 dtype recommended)</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>yaw rotation in radians</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>float</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.transform_point">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">transform_point</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">point</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">transf_matrix</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="headerlink" href="#l5kit.geometry.transform_point" title="Permalink to this definition">¶</a></dt>
<dd><p>Transform a single vector using transformation matrix.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>point</strong> (<em>np.ndarray</em>) – vector of shape (N)</p></li>
<li><p><strong>transf_matrix</strong> (<em>np.ndarray</em>) – transformation matrix of shape (N+1, N+1)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>vector of same shape as input point</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.transform_points">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">transform_points</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">points</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">transf_matrix</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="headerlink" href="#l5kit.geometry.transform_points" title="Permalink to this definition">¶</a></dt>
<dd><p>Transform points using transformation matrix.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>points</strong> (<em>np.ndarray</em>) – Input points (Nx2), (Nx3) or (Nx4).</p></li>
<li><p><strong>transf_matrix</strong> (<em>np.ndarray</em>) – 3x3 or 4x4 transformation matrix for 2D and 3D input respectively</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>array of shape (N,2) for 2D input points, or (N,3) points for 3D input points</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.transform_points_transposed">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">transform_points_transposed</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">points</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">transf_matrix</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="headerlink" href="#l5kit.geometry.transform_points_transposed" title="Permalink to this definition">¶</a></dt>
<dd><p>Transform points using transformation matrix.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>points</strong> (<em>np.ndarray</em>) – Input points (2xN), (3xN) or (4xN).</p></li>
<li><p><strong>transf_matrix</strong> (<em>np.ndarray</em>) – 3x3 or 4x4 transformation matrix for 2D and 3D input respectively</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>array of shape (2,N) for 2D input points, or (3,N) points for 3D input points</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.voxel_coords_to_intensity_grid">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">voxel_coords_to_intensity_grid</code><span class="sig-paren">(</span><em class="sig-param">voxel_coords: numpy.ndarray</em>, <em class="sig-param">shape: tuple</em>, <em class="sig-param">dtype: numpy.dtype = &lt;class 'numpy.float32'&gt;</em>, <em class="sig-param">drop_out_of_bounds: bool = True</em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="headerlink" href="#l5kit.geometry.voxel_coords_to_intensity_grid" title="Permalink to this definition">¶</a></dt>
<dd><p>Puts coords into a grid: for each grid cell the number of points is written there.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>voxel_coords</strong> (<em>np.ndarray</em>) – input array with coords (N,3) in intensity grid</p></li>
<li><p><strong>shape</strong> (<em>tuple of ints</em>) – intensity grid shape</p></li>
</ul>
</dd>
<dt class="field-even">Keyword Arguments</dt>
<dd class="field-even"><ul class="simple">
<li><p><strong>dtype</strong> (<em>data-type</em>) – data type for the intensity grid (default: {np.float32})</p></li>
<li><p><strong>drop_out_of_bounds</strong> (<em>bool</em>) – [description] (default: {True})</p></li>
</ul>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>np.ndarray – Array with given shape, the value of each cell is the amount of coords for that point.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.world_to_image_pixels_matrix">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">world_to_image_pixels_matrix</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">image_shape</span><span class="p">:</span> <span class="n">Tuple<span class="p">[</span>int<span class="p">, </span>int<span class="p">]</span></span></em>, <em class="sig-param"><span class="n">pixel_size_m</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">ego_translation_m</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">ego_yaw_rad</span><span class="p">:</span> <span class="n">Optional<span class="p">[</span>float<span class="p">]</span></span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">ego_center_in_image_ratio</span><span class="p">:</span> <span class="n">Optional<span class="p">[</span>numpy.ndarray<span class="p">]</span></span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="headerlink" href="#l5kit.geometry.world_to_image_pixels_matrix" title="Permalink to this definition">¶</a></dt>
<dd><p>Constructs a transformation matrix from world coordinates to image pixels.
Note: we’re ignoring Z coord, with the assumption that it won’t change dramatically.
This means last row of the matrix will be [0,0,1] and we will transform 2D points in fact (X,Y)</p>
<blockquote>
<div><p>Args:
image_shape (Tuple[int, int]): the size of the image
pixel_size_m (np.ndarray): how many meters a pixel cover in the two directions
ego_translation_m (np.ndarray): translation of the ego in meters in world-coordinates
ego_yaw_rad (Optional[float]):if defined, rotation is applied so that ego will always face to the right</p>
<blockquote>
<div><p>in the resulting image coordinates</p>
</div></blockquote>
<dl class="simple">
<dt>ego_center_in_image_ratio (Optional[np.ndarray]): enables to position the ego in different places</dt><dd><p>in the resulting image. The [0.5, 0.5] value puts it in the center</p>
</dd>
</dl>
</div></blockquote>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>3x3 transformation matrix</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="l5kit.geometry.yaw_as_rotation33">
<code class="sig-prename descclassname">l5kit.geometry.</code><code class="sig-name descname">yaw_as_rotation33</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">yaw</span><span class="p">:</span> <span class="n">float</span></em><span class="sig-paren">)</span> &#x2192; numpy.ndarray<a class="headerlink" href="#l5kit.geometry.yaw_as_rotation33" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a 3x3 rotation matrix from given yaw.
The rotation is counter-clockwise and it is equivalent to:
[cos(yaw), -sin(yaw), 0.0],
[sin(yaw), cos(yaw), 0.0],
[0.0, 0.0, 1.0],</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>yaw</strong> (<em>float</em>) – yaw rotation in radians</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>3x3 rotation matrix</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>np.ndarray</p>
</dd>
</dl>
</dd></dl>

<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="l5kit.geometry.angle.html">l5kit.geometry.angle module</a></li>
<li class="toctree-l1"><a class="reference internal" href="l5kit.geometry.image.html">l5kit.geometry.image module</a></li>
<li class="toctree-l1"><a class="reference internal" href="l5kit.geometry.transform.html">l5kit.geometry.transform module</a></li>
<li class="toctree-l1"><a class="reference internal" href="l5kit.geometry.voxel.html">l5kit.geometry.voxel module</a></li>
</ul>
</div>
</div>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="l5kit.geometry.angle.html" class="btn btn-neutral float-right" title="l5kit.geometry.angle module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="l5kit.evaluation.write_csv.html" class="btn btn-neutral float-left" title="l5kit.evaluation.write_csv module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        
        &copy; Copyright 2020, Lyft Level 5

    </p>
  </div>
    
    
    
    Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a
    
    <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a>
    
    provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>